package com.mxx.common.generator;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;

public class EntityInfoUtil {

    private final static Map<Class, EntityInfo> ENTITY_INFO_MAP = new HashMap<>();
    private final static Map<Field, EntityField> ENTITY_FIELD_MAP = new HashMap<>();


    public static EntityField toEntityField(Field field) {
        EntityField entityField = ENTITY_FIELD_MAP.get(field);
        if (entityField == null) {
            entityField = new EntityField(field);
            entityField.setFieldClass(field.getType());
            ENTITY_FIELD_MAP.put(field, entityField);
        }
        return entityField;
    }

}
